package com.xiaoshuidi.cloud.module.report.dal.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.xiaoshuidi.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.xiaoshuidi.cloud.module.report.dal.DO.ContractHouseOwnerDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
@InterceptorIgnore(tenantLine = "true")
public interface ContractHouseOwnerMapper extends BaseMapperX<ContractHouseOwnerDO> {


    @Select("select * from contract_house_owner where  " +
            " contract_status in ('active','normal_end','abnormal_end') and  start_time <= #{date} and deleted = 0 " +
            " and (eviction_time is null or end_time >= #{date} )")
    @ResultMap("mybatis-plus_ContractHouseOwnerDO")
    List<ContractHouseOwnerDO> selectActiveByDate(@Param("date")LocalDate date);



    @Select("select id from contract_house_owner where contract_node = 'renewal' and deleted = 0 ")
    List<Long> selectRenewalIds();


}
